<template>
  <m-win v-model:window_open="cfg.loginif" title="登录猫燐工具箱账号">
    <template #content>
      <div class="nbox1 boxgap">
        <n-tabs type="line" size="large" v-model:value="cfg.logintab">
          <n-tab-pane name="login" label="登录猫燐工具站账号">
            <div class="nbox2" style="margin-top: 12px">
              <n-h3 prefix="bar"> 使用QQ互联登录 </n-h3>
              <div class="nbox3" @click="cfg.hdct.login">
                <img src="./Connect_logo_5.png" style="width: 150px" />
              </div>
              <n-h3 prefix="bar"> 使用猫燐工具站账号登录 </n-h3>

              <n-form class="nbox3">
                <n-form-item label="* 账号 / 名称">
                  <n-input
                    placeholder="请输入账号"
                    v-model:value="$cfg.loginfm.username"
                    @keyup.enter="ct.axioslogin"
                  />
                </n-form-item>
                <n-form-item path="password" label="* 登录密码">
                  <n-input
                    autocomplete
                    type="password"
                    placeholder="请输入密码"
                    v-model:value="$cfg.loginfm.pw"
                    @keyup.enter="ct.axioslogin"
                  />
                </n-form-item>
              </n-form>
            </div>
          </n-tab-pane>
          <n-tab-pane name="register" label="注册猫燐工具站账号">
            <div class="nbox2" style="margin-top: 12px">
              <n-h3 prefix="bar">使用QQ互联注册 </n-h3>
              <div class="nbox3" @click="cfg.hdct.login">
                <img src="./Connect_logo_5.png" style="width: 150px" />
              </div>
              <n-h3 prefix="bar"> 注册猫燐工具站账号 </n-h3>
              <n-form class="nbox3">
                <n-form-item label="* 账号 / 名称">
                  <n-input
                    placeholder="用于登录或显示名称     可以使用中文"
                    v-model:value="$cfg.loginfm.username"
                    @keyup.enter="ct.axiosregister"
                  />
                </n-form-item>
                <n-form-item path="password" label="* 登录密码">
                  <n-input
                    autocomplete
                    type="password"
                    placeholder="请输入密码"
                    v-model:value="$cfg.loginfm.pw"
                    @keyup.enter="ct.axiosregister"
                  />
                </n-form-item>
              </n-form>
            </div>
          </n-tab-pane>
        </n-tabs>
      </div>
    </template>
    <template #footer>
      <n-button
        :size="cfg.sizebtn"
        v-if="cfg.logintab == 'register'"
        type="gt_y"
        @click="ct.axiosregister"
        >注册并登录</n-button
      >
      <n-button @click="ct.axioslogin" v-else :size="cfg.sizebtn" type="gt_y"
        >登录账号</n-button
      >
    </template>
  </m-win>
</template>

<script>
import { cfg } from "@/cfg/cfg.js";
export default {
  props: {
    val: {
      type: Object,
      required: true,
    },
    ct: {
      type: Object,
      required: true,
    },
  },
  setup() {
    const set = {
      login: () => {
        var A = window.open(
          "https://sv2api.ww2.ren/?t=get/os/qqauth",
          "TencentLogin",
          "width=450,height=320,menubar=0,scrollbars=1,resizable=1,status=1,titlebar=0,toolbar=0,location=1"
        );
      },
    };
    return {
      cfg,
      set,
    };
  },
};
</script>
